﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using System.Data;

namespace logic
{
    public class paymentHistory
    {
        public static void update(PaymentHistoryEntity payH)
        {
            PaymentHistory.update(payH);
        }
       
        public static DataSet select(string where, string orderby, int pagesize, int pageindex)
        {
            return DAL.DbHelper.ExecuteDataSetPageSize("*", "vw_PaymentHistory_list", where, "payId", orderby, pagesize, pageindex);
        }

        public static PaymentHistoryEntity getByPayId(int payId)
        {
            return PaymentHistory.getByPayId(payId);
        }

        public static DataTable listWithExtend(int companyId)
        {
            return PaymentHistory.listWithExtend(companyId);
        }
        public static DataTable listWithCollect(int companyId, DateTime? startDt, DateTime? endDt, string type)
        {
            return PaymentHistory.listWithCollect(companyId, startDt, endDt, "","", "", type);
        }
        /// <summary>
        /// 财务管理汇总
        /// </summary>
        /// <param name="companyId">企业编号</param>
        /// <param name="startDt">开始日期,默认为 NULL</param>
        /// <param name="endDt">结束日期,默认为 NULL</param>
        /// <param name="companyName">企业名称</param>
        /// <param name="companyNo">企业编号</param>
        /// <param name="payMethod">支付类型</param>
        /// <param name="type">账单类型：1表示采购商；2表示供应商</param>
        /// <returns></returns>
        public static DataTable listWithCollectByFinancial(int companyId, DateTime? startDt, DateTime? endDt, string companyName, string companyNo, string payMethod, string type)
        {
            return PaymentHistory.listWithCollect(companyId, startDt, endDt,companyName,companyNo, payMethod, type);
        }
        public static DataSet selectWithExtend(string where, string orderby, int pagesize, int pageindex)
        {
            return DAL.DbHelper.ExecuteDataSetPageSize("*", "vw_PaymentHistory_listWithExtend", where, "payId", orderby, pagesize, pageindex);
        }

        public static DataTable listWithPreview(string where)
        {
            return PaymentHistory.listWithPreview(where);
        }

        public static int insertPayableByFinance(string where, DateTime? startDt, DateTime? endDt)
        {
            return PaymentHistory.insertPayableByFinance(where, startDt, endDt);
        }
    }
}
